using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using TMPro;
using UnityEngine;

public class UI_StatSlot : MonoBehaviour
{
    [SerializeField] private PlayerStatType _playerStatType;

    [SerializeField] private TextMeshProUGUI _playerStatValueTMP;
    private PlayerStatGroup _playerStatGroup;
    
    public void SetupStatSlot(PlayerStatGroup playerStatGroup)
    {
        _playerStatGroup = playerStatGroup;

        UpdateStatSlot();
    }
    public void UpdateStatSlot()
    {
        _playerStatValueTMP.text = GetPlayerStat().GetValue().ToString();
    }
    private Stat GetPlayerStat()
    {
        return _playerStatType switch
        {
            PlayerStatType.MaxHealth => _playerStatGroup.maxHealth,
            PlayerStatType.armor => _playerStatGroup.armor,
            PlayerStatType.critChance => _playerStatGroup.critChance,
            PlayerStatType.critPower => _playerStatGroup.critPower,
            PlayerStatType.damageBouns => _playerStatGroup.damageBouns,
            PlayerStatType.moveSpeed => _playerStatGroup.moveSpeed,

            _ => null
        };
    }
} 
